草庐IT

c++ - std::string 和 placement new

全部标签

c - OpenSSL 1.0.2 和错误 "SSL_CTX_new:library has no ciphers"

我正在尝试编译并运行来自libest的示例(客户端简单)。为此,我在Windows上编译了OpenSSL,然后用它编译并链接了libest。问题是当我运行程序时,我得到了error:140A90A1:SSLroutines:SSL_CTX_new:libraryhasnociphers:查看调试器中的代码,我可以确认调用了OPENSSL_add_all_algorithms_noconf,以及:ERR_load_crypto_strings()ENGINE_load_builtin_engines();SSL_library_init();SSL_load_error_strings(

c - OpenSSL 中未定义对 RSA_generate_key 的引用?

这个问题在这里已经有了答案:LinkinglibsslandlibcryptoinGCC[duplicate](2个答案)关闭6年前。我在文件rsatest.c中有以下代码。我正在尝试生成RSAkey对。#include#includeintmain(){RSA*rsa=RSA_generate_key((constint)1024,(constint)3,0,0);return0;}我正在编译这个gcc-I../include/-L.-lcrypto-lsslrsatest.c我收到以下错误。undefinedreferenceto`RSA_generate_key'我是否以错误的顺

c - 为 Pro Micro 编写 Windows 驱动程序

首先,我对USB的功能知之甚少,更不用说编写驱动程序了;本质上是试图让这个项目成为一种学习体验。我的设置包括SparkFunProMicro板和一台Windows机器。我有一个连接到ProMicro的电位器,我的最终目标是将电位器的值发送到主机并使用该值来改变系统音量等...Arduino库附带一个Serial库,我可以使用它通过USB发送内容。我目前有一个正在运行的Arduino程序,每1秒发送1个字节,Windows机器上有一个C程序“连接”到COM端口并读取通过的字节(这部分我工作正常)。问题是,当ProMicro连接到计算机时,它会出现在随机选择的COM端口上,我认为您无法分辨

c - 将 offsetof 与枚举一起使用不会在 Visual Studio 2015 中编译

我有以下代码可以在VisualStudio2013中正常编译,但不能在VisualStudio2015中编译。在VS2015上,我收到错误“errorC2057:expectedconstantexpression”#includestructtemp{inta;charb;};intmain(){enum{TEST=(offsetof(structtemp,a)?1:2)};return0;}我使用以下命令编译它:cl-nologo-FS-MD-EHsc-Od-D_DEBUG-Zi-ctest.c我查看了stddef.hheader,似乎offsetof宏在VS2015中发生了变化。

c++ - 如何优化 std::map insert() 函数?

解释我正在尝试的最好方法是使用这个示例(使用VisualStudio2008SP1编译):structELEMENT1{//ItsmembersELEMENT1(){//Constructorcode}~ELEMENT1(){//Destructorcode}};std::mapmap;std::pair::iterator,bool>resIns;ELEMENT1element;std::wstringstrKey;for(size_ti=0;i(strKey,element));//ThislinecallsELEMENT1constructor&destructortwice//

Windows 设备 : get "location" string for a given IMFActivate* of a UVC webcam

当转到Windows的“设备管理器”并单击(几乎)列表中的任何设备时,“常规”选项卡中的一条信息称为“位置”。这是一个字符串:人类可读,例如“在NVIDIAGeForceGTX1080上”半有用的,例如“位置0(内部高清音频总线)”或“PCI总线9,设备0,功能0”USB位置,例如“Port_#0004.Hub_#0015”甚至“0009.0000.0000.004.000.000.000.000.000”该信息可通过Windows的Unifieddevicepropertymodel获得。API。我正在寻找的是从给定的IMFActivate对象获取该信息。有办法吗?我找不到如何从该激

c - 为什么我收到错误 "The program can' t start because msys-2.0.dll is missing from your computer”?有修复吗?

我用C写了一个很长的程序,所以我没有写完整的代码。这些是我使用的库(以防万一)#include#include#include#include#include#include#include#include"xlsxwriter.h"该程序在我的Windows计算机和我的工作计算机以及我有相同程序的地方运行完美。但是当我在同事电脑上运行时出现这个错误:Systemerror:Theprogramcan'tstartbecausemsys-2.0.dllismissingfromyourcomputer.Tryreinstallingtheprogramtofixthisproblem.

c++ - 如何修剪存储在 std::set 中的字符串?

我正在使用VS2012开发MFC应用程序。在此应用程序中,我想清理CString的容器。使用Trim()对象成员函数。首先,我使用了std::vector作为容器,如下图MCVE:#define_AFXDLL//CString#include//CString#includeintmain(){std::vectorv;v.push_back(_T("Test"));v.begin()->Trim();return0;}这会按预期进行编译和工作。然后,我想更换std::vector通过std::set.因此,我包括了#include而不是#include并更改了main()如下:int

string - Windows 批处理 : find a string in file with "[" in the string

我有一个函数已经可以删除多个文件中不包含字符串的所有行,它非常适合与常见字符串一起使用:@echooffset"string_to_find=level.waypoints["for/f"tokens=*"%%ain('dir/B*.gsc')do(set"tempfile=%temp%\%%a"ifexist"%tempfile%"del"%tempfile%">NULfindstr/C:"%string_to_find%""%~dp0\%%a">>"%tempfile%"ifnoterrorlevel1(del"%%a">NULmove/Y"%tempfile%""%~dp0\%%

c - 如何在 fork 的子进程期间在字符串上打印\n

我的代码:#include#include#include#includeintmain(){fork();printf("Showmethenewlinebeforethepidchilddies\n");return0;}输出:>ShowmethenewlinebeforethepidchilddiesShowmethenewlinebeforethepidchilddies"\n>我的预期结果是将'\n'显示为字符串的一部分并有两行,如下所示:>string1\n>string2\n>但我得到以下信息:>string1string2\n>我尝试使用fflush(stdout),但